<template>
	<div id="renewContractAll" class="renewContractAll">
		<x-table full-bordered style="background-color:#fff;">
			<thead>
			<tr class="renewContractTable">
				<th>姓名</th>
				<th>课程</th>
				<th>剩余课时</th>
				<th>有效期至</th>
			</tr>
			</thead>
			<tbody>
			<tr class="renewContractTableCell" v-for="item in itemList">
				<td><router-link style="text-decoration: none; color: #43abe3" :to="{name:'customerDetails', params: { id: item.id }}">{{item.student}}</router-link></td>
				<td>{{item.lesson}}</td>
				<td>{{item.points}}</td>
				<td>{{item.end_date}}</td>
			</tr>
			</tbody>
		</x-table>
	</div>
</template>

<script>
	import bus from '@/event/eventBus'
	import NetWorking from '../../../../utils/networking'
	import {XTable} from 'vux'
	export default {
		name: "teacher-lesson-rank",
		props: ['type'],
		components: {
			XTable
		},
		data() {
			return {
				itemList: []
			}
		},
		methods: {
			jumpTo: function (id) {
				//组件间传递参数
				this.$router.push({ name: "customerDetails", params: { id: id }})
			},
		},
		created: function () {
			bus.$emit("barController", 1)
			bus.$emit("setTopSimpleTitle", '待续课会员')

			let user = this.$store.state.user.userModel.sysUser

			let _this = this
			NetWorking.doGet(
				'ai/teachers/getRenewContractModelListAllByUser',
				null,
				{
					params: {
						username: user.username
					}
				}
			).then(
				response => {
					let rs = response.data
					if(rs.error_code == 0){
						_this.itemList = rs.renew_contract_list
					}else{
						alert(rs.error_message)
					}
				}
			)
		}
	}
</script>

<style scoped>
	.renewContractAll{
		margin-top: 46px;
		margin-bottom: 100px;
	}

	.renewContractTable {
		background: #fffde2;
		color: black;
		font-size: 12px;
	}

	.renewContractTableCell{
		font-size: 12px;
	}
</style>